"""
10.使用面向对象配置不同需求的类

"""




from redis import StrictRedis
# 导入logging
import logging


# 1.集成配置类

class Config():
    SECRET_KEY = "1234567"
    DEBUG = True
    # 2.配置数据库
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/news_movie"
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # 3.配置redis
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # 4.配置Session
    # 存储方式
    SESSION_TYPE = "redis"
    # 存储对象，存储在什么地方
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    # 存储ID是否加密
    SESSION_USE_SIGNER = True
    # 是否永久存储
    SESSION_PERMANENT = False
    # 设置存储时间
    PERMANENT_SESSION_LIFETIME = 86400 *2


# 11.使用面向对象的方式配置不同需求的类
class DevelopConfig(Config):
    DEBUG = True
    # 12.设置log日志警告的等级
    LOG_LEVEL = logging.DEBUG

class ProductConfig(Config):
    DEBUG = False
    # 12.设置log日志警告的等级
    LOG_LEVEL = logging.ERROR

class TestingConfig(Config):
    DEBUG = True
# 11.封装进字典中
config = {
    "develop":DevelopConfig,
    "product":ProductConfig,
    "testing":TestingConfig
}


